﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.PhanQuyen.JobTitlesForm>" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="DONGACS.DTO" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>


<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/JobTitles/JobTitles.js") %>"></script>

    
    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            selectMenu("system-JobTitles");
            $("#JobTitlesSearch").focus();
        });
    
    </script>


    <form id="form" method="POST" action="#">

    <%=Html.Hidden("JobTitleID")%>
    <%=Html.Hidden("PageNumber", Model.PageNumber)%>
    <div class="box round first fullpage">
            <h3> Quản lý Chức vụ</h3>
        <table class="table_outsite">
            <tr>
                <td></td>
                <td style="width: 40%">
                    <%--Thông Báo--%>
                    <%
                        if (Model.MessageCreateJobTitles != null)
                        {
                    %>
                    <div id="MessageCreateJobTitles" style="font-size: 12px; color: Blue; font-weight: bold">
                        <%=Model.MessageCreateJobTitles %></div>
                    <%
                        }
                    %>
                    <%
                        if (Model.MessageEditJobTitles != null)
                        {
                    %>
                    <div id="MessageEditJobTitles" style="font-size: 12px; color: Blue; font-weight: bold">
                        <%=Model.MessageEditJobTitles %></div>
                    <%
                        }
                    %>
                    <%--end--%>
                </td>
                <td   style="padding-top:10px;text-align: right; width: 100%;">
                    <input type="button"class="btn btn-grey"  value="Tạo/Cập nhật " onclick="DoCreateOrEdit()" />
                    <input type="button"class="btn btn-grey"  value="Tạo mới" onclick="javascript:DoNewAjax();" />
                    <input type="button"class="btn btn-grey"  value="Xóa" onclick="javascript:DoDelete();" />
                    <input type="button" class="btn btn-grey" value="Nhập lại" onclick="javascript:DoReset();" />
                </td>
            </tr>
        </table >
        <table >
            <tr>
                <td nowrap="nowrap">
                    Mã chức vụ :
                </td>
                <td colspan="2">
                    <input type="text" name="IdJob" id="IdJob" readonly="readonly" value='<%=Model.ID %>'/>
                </td>
            </tr>
            <tr>
                <td style="width: 1%" nowrap="nowrap">
                    Ngày tạo:
                </td>
                <td style="width: 2%" nowrap="nowrap">
                    <input type="text" name="CreateDate" id="CreateDate" disabled="disabled"  value="<%=Model.CreateDate.ToShortDateString()%>" />
                </td>
                <td style="width: 5%" nowrap="nowrap">
                    <b>Chức vụ:</b>
                </td>
                <td style="width: 20%">
                    <input  type="text" style="width: 50%" value="<%=Model.JobTitle%>" id="JobTitle" name="JobTitle" />
                    <div id="JobTitleMessage" class="red"></div>
                </td>                        
            </tr>
            <tr>
                <td nowrap="nowrap">
                    Ngày cập nhật:
                </td>
                <td>
                    <input type="text" id="UpdateDate" disabled="disabled" value='<%=Model.UpdateDate.ToShortDateString()%>' />                                                               
                </td>
                <td nowrap="nowrap">
                    Mô tả:
                </td>
                <td>
                    <input type="text" style="width: 50%"  id="Description" name="Description" value="<%=Model.Description%>"/>                            
                </td>                        
            </tr>
            <tr>
                <td nowrap="nowrap">
                    Người tạo:
                </td>
                <td>
                    <input type="text"  name="CreateBy" id="CreateBy" disabled="disabled" value="<%=Model.CreateByUser%>" />
                </td>
                <td nowrap="nowrap">
                    Người cập nhật:
                </td>
                <td>
                    <input type="text" style="width: 50%"  id="UpdateBy" disabled="disabled" value='<%=Model.UpdateByUser%>' /> 
                </td>
            </tr>
        </table>

               
        <table class="table table-striped table-bordered dataTable"  >
            <tr>
              
                <td colspan="2" class="first" style="width: 100%">
                 Danh sách chức vụ  <span style="float: right"> <%=Html.TextBox("JobTitlesSearch", Model.JobTitlesSearch
                                                    , new { @size = 50, @onkeypress = "if (event.keyCode==13) { return doSearch(); }" })%>
                    <img onclick="javascript:doSearch();" style="vertical-align: middle; cursor:pointer" src="<%=ResolveUrl("~/Content/img/search_icon.gif")%>"
                        alt="Tìm theo Chức vụ" title="Tìm theo Chức vụ"/></span>  
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <table cellspacing="0" cellpadding="0"  class="table">
                        <tr class="title">
                            <td style="border: 1px solid #ddd " width="8%">
                                <strong>Mã</strong>&nbsp;
                            </td>
                            <td style="border: 1px solid #ddd "nowrap="nowrap">
                                <strong>Chức Vụ</strong>
                            </td>
                            <td style="border: 1px solid #ddd "align="left" nowrap="nowrap">
                                <strong>Mô Tả</strong>
                            </td>
                            <td style="border: 1px solid #ddd "width="13%" nowrap="nowrap">
                                <strong>Ngày Cập Nhật</strong>
                            </td>
                            <td style="border: 1px solid #ddd "class="last" nowrap="nowrap">
                                <strong>Người Cập Nhật</strong>
                            </td>
                        </tr>
                        <%--JobTitles List--%>

                        <%
                                
                        IList<JobTitlesDto> JobTitlesDtoList = Model.JobTitlesPagedList;

                        foreach (JobTitlesDto dto in JobTitlesDtoList)
                        {
                        %>
                        <tr class="item_row" onclick="javascript:highlight(this);EditJobTitlesAjax(<%=dto.ID%>);">
                            <td style="border: 1px solid #ddd " class="first" align="left">
                                &nbsp;<%=dto.ID%>
                            </td>
                            <td style="border: 1px solid #ddd " align="left">
                                <%=dto.JobTitle%>&nbsp;
                            </td>
                            <td style="border: 1px solid #ddd " align="left">
                                <%=dto.Description %>
                            </td>
                            <td style="border: 1px solid #ddd " align="left">
                                <%=dto.UpdateDate.ToShortDateString()%>&nbsp;
                            </td>
                            <td style="border: 1px solid #ddd " class="last">
                                <%=dto.UpdateByUser%>&nbsp;
                            </td>
                        </tr>
                        <%}
                        %>
                        <tr class="border_bottom">
                            <td class="first" style="background: #DDDDDD">
                            </td>
                            <td class="last" colspan="7" align="right" style="background: #DDDDDD; padding-right: 10px">
                                     
                                    <%
                                     
                                    PagerOptions pagerOptions = new PagerOptions();
                                    pagerOptions.PageIndexParameterName = "id";
                                    pagerOptions.NextPageText = "Tiếp";
                                    %>
                                <div><%=Html.Pager(Model.JobTitlesPagedList,pagerOptions) %></div>
                                    
                            </td>
                        </tr>
                        <%--dã xóa--%>
                    </table>
                </td>
            </tr>
        </table>
    
    </div>
    </form>
</asp:Content>
